<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 梁家源
  Date: 2021/4/21
  Time: 10:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户管理</title>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/layui.js" type="text/javascript"
            charset="UTF-8"></script>
    <script src="${pageContext.request.contextPath}/static/script/jquery-1.7.2.js" type="text/javascript"
            charset="UTF-8"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin: 20px" >
    <legend style="margin-left: 50px;">用户管理</legend>
</fieldset>
<div class="layui-container">
    <%--        <div class="layui-row" style="border: 1px solid black;border-color: #9F9F9F" >--%>
    <div class="layui-row" >
        <table class="layui-table" lay-skin="nob">
            <colgroup>
                <col width="15px">
                <col width="100px">
                <col width="110px"><!--名称-->
                <col width="170px">
                <col width="30px"><!--学号-->
                <col width="100px">
                <col width="100px"><!--余额-->
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>序号</th>
                <th>用户I&nbsp;D</th>
                <th>用户名称</th>
                <th>用户院系</th>
                <th>用户学号</th>
                <th>用户状态</th>
                <th>用户余额</th>
                <th>操&nbsp;作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="user" varStatus="status" items="${userList}">
                <tr>
                    <td>${status.count}</td>
                    <td>${user.uid}</td>
                    <td>
                        <a href="">
                            <i class="layui-icon">&#xe68e;</i>&nbsp;${user.uname}
                        </a>
                    </td>
                    <td>${user.ufaculty}</td>
                    <td>${user.unumber}</td>
                    <td>
                        <c:if test="${user.upid == 1}">正常</c:if>
                        <c:if test="${user.upid == 2}">冻结</c:if>
                    </td>
                    <td>${user.ubalance}</td>
                    <td>
                        <a href="${pageContext.request.contextPath}/frozenUser?uid=${user.uid}&upid=${user.upid}">
                            <button type="button" class="layui-btn layui-btn-sm <c:if test="${user.upid ==1 }">layui-btn-normal</c:if> ">
                                <c:if test="${user.upid == 1}">冻结</c:if>
                                <c:if test="${user.upid == 2}">解冻</c:if>
                            </button>
                        </a>
                        <a href="${pageContext.request.contextPath}/deleteUserByAdmin?uid=${user.uid}&upid=${user.upid}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-black">删除</button>
                        </a>

                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>

    <script>
        <c:if test="${isDelete == 0}">
            layui.use('layer', function(){
                var layer = layui.layer;
                layer.msg('先冻结，再删除');
            });
        </c:if>
    </script>

</div>
</body>
</html>
